<!--
 * @Description:: 请补充填写
 * @Version: 1.0
 * @Author: 小白
 * @Date: 2022-04-14 14:32:34
 * @LastEditors: 小白
 * @LastEditTime: 2025-09-03 16:13:35
 * @FilePath: \tmsadmin\src\views\home\components\search.vue
-->
<template>
  <el-card class="search_card" shadow="never">
    <template #header>
      <div class="card-header">
        <span>条件筛选</span>
      </div>
    </template>
    <el-form :model="form" label-width="100px">
      <el-row>
        <el-col :lg="6" :md="8">
          <el-form-item label="收货人全称">
            <el-input
              style="width: 100%"
              v-model="form.consignee"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="8">
          <el-form-item label="发运订单">
            <el-input
              style="width: 100%"
              v-model="form.shippingOrder"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="8">
          <el-form-item label="预计发货日期">
            <el-date-picker
            v-model="form.deliveryTime"
            type="date"
            :format="'YYYY-MM-DD'"
            :value-format="'YYYY-MM-DD'"
            placeholder="请选择日期"
            style="width: 100%;"
          />
          </el-form-item>
        </el-col>
        <el-col :lg="6" :md="8">
          <el-form-item label="车牌号">
            <el-input
              style="width: 100%"
              v-model="form.plateNumber"
              placeholder="请输入"
            />
          </el-form-item>
        </el-col>
        <!-- <el-col :lg="6" :md="8">
          <el-form-item label="运单时间">
            <el-date-picker
        v-model="dateArr"
        type="daterange"
        unlink-panels
        range-separator="至"
        start-placeholder="开始时间"
        end-placeholder="结束时间"
        :format="'YYYY-MM-DD'"
        @change="ChangeDate"
        :value-format="'YYYY-MM-DD'"/>
          </el-form-item>
        </el-col> -->
        <el-col :lg="6" :md="8">
          <el-form-item label="运单状态">
            <el-select v-model="form.state" placeholder="请选择" style="width: 100%">
              <el-option label="待发货" value="0" />
              <el-option label="已发货" value="1" />
              <el-option label="已签收" value="2" />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :lg="18" :md="24" style="text-align: right">
          <el-button type="primary" @click="searchFun"> 搜索 </el-button>
          <el-button @click="restFun"> 重置 </el-button>
        </el-col>
      </el-row>
    </el-form>
  </el-card>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const emits = defineEmits(['search'])
const dateArr = ref([])
const form = ref({
  consignee: '',
  shippingOrder:'',
  deliveryTime:'',
  orderStartTime:"",
  orderEndTime:'',
  plateNumber: '',
  state:''
})
const ChangeDate = (val: any) => {
  form.value.orderStartTime = val[0]
  form.value.orderEndTime = val[1]
}
const searchFun = () => {

  emits('search', form.value)
}
const restFun = () => {
  form.value = {
    consignee: '',
    shippingOrder:'',
    deliveryTime: '',
    orderStartTime:"",
    orderEndTime:'',
    plateNumber: '',
    state:''
  }
  dateArr.value = []
  emits('search', form.value)
}
</script>

<style lang="scss" scoped>
// @import '@/style/variables.scss';
.card-header {
  display: flex;
  justify-content: space-between;
  .more_text {
    cursor: pointer;
    color: $color;
  }
}
</style>
